package com.nomi.blog.controller;

import com.nomi.blog.entity.User;
import com.nomi.blog.utils.Result;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/test")
public class TestController {
    /**
     * 测试接口：接收 User 对象并返回封装后的 Result<User>
     */
    @PostMapping("/user")
    public Result<User> test(@RequestBody User user) {
        System.out.println("接收到的用户数据: " + user);
        System.out.println(user.getNickname());
        // 返回成功结果，data 中包含传入的 user
//        System.out.println(Result.success("用户信息已接收", user));
        return Result.success("用户信息已接收", user);
    }
}
